const app = getApp();
Page({
  data: {
    banner_info:[],
    banner_id:'',
  },

  onShow:function(){

  },

  onLoad:function(options){
    let _this = this,
     banner_id = options.banner_id;
    _this.setData({
      banner_id:banner_id
    })
    _this.get_banner_info();
  },

  //获取个人信息
  get_banner_info:function(){
    let _this = this,
      banner_id = _this.data.banner_id;
    app._post('api/member/get_banner_info', {banner_id:banner_id}, function(result) {
      _this.setData({
        banner_info:result.data
      })
    });
  },

  //使用皮肤
  use_pifu:function(){
    let _this = this,
      banner_id = _this.data.banner_id;
    app._post('api/member/use_pifu', {banner_id:banner_id}, function(result) {
      if(result.code == 200){
        var icon = 'success';
        setTimeout(function() {
          wx.redirectTo({
            url: '/pages/index/index'
          })
        }, 1500)
      }else{
        var icon = 'none';
      }
      wx.showToast({
        title:result.msg,
        icon: icon,
        duration: 1500
      })
    });
  },
})